import {take,call,put,fork} from 'redux-saga/effects';
import getIndProductData from '../servers/serIndProduct';
function *sagwatchIndProduct() {
    while(true){
        let action=yield take('INDPRODUCT');
        let payload=yield call(getIndProductData)
        let temPayload=[];
        let temPrivate=[
            {class:'colf7'},
            {class:'colfe'},
            {class:'col5f'},
        ];
        if (payload.code===200){
            temPayload=payload.data;
            for (let i in temPayload){
                temPayload[i]['class']=temPrivate[i]['class']
            }
        }
        yield put({type:'indproduct',data:{aIndProduct:temPayload}});
        if (action.data.success()){
            action.data.success()
        }
    }
}
export default [
    fork(sagwatchIndProduct)
]